import request from '@/utils/request'
import type {
  patientMedicineOrderPreApi,
  patientMedicineOrderPreReq,
  patientOrderAddressApi,
  patientMedicineOrderReq,
  patientMedicineOrderDetailApi,
  patientOrderLogisticsApi
} from '@/types/order'

// 药品支付页面
export const patientMedicineOrderPre = (data: patientMedicineOrderPreReq) => {
  return request<patientMedicineOrderPreApi>('/patient/medicine/order/pre', 'get', data)
}

// 地址列表
export const patientOrderAddress = () => {
  return request<patientOrderAddressApi[]>('/patient/order/address')
}

// 药品订单
export const patientMedicineOrder = (data: patientMedicineOrderReq) => {
  return request<{ id: string }>('/patient/medicine/order', 'post', data)
}

// 支付详情
export const patientMedicineOrderDetail = (id: string) => {
  return request<patientMedicineOrderDetailApi>(`/patient/medicine/order/detail/${id}`)
}

// 订单-查询物流信息
export const patientOrderLogistics = (id: string) => {
  return request<patientOrderLogisticsApi>(`patient/order/${id}/logistics`)
}
